package book;
//书架
public class BookList {

    //最多可以放10本书
    private Book[] books = new Book[10];

    private int userSize;//实时记录 当前books里有多少书

    public BookList() {
        books[0] = new Book("三国演义","罗贯中",19,"小说");
        books[1] = new Book("西游记","吴承恩",29,"小说");
        books[2] = new Book("红楼梦","曹雪芹",9,"小说");
        userSize = 3;
    }

    //pos位置一定合法
    public Book getBook(int pos) {
        return books[pos];
    }

    /**
     *
     * @param pos 位置一定是合法的
     * @param book 是你要放入的书籍
     */
    public void setBooks(int pos,Book book){
        books[pos] = book;
    }

    /**
     * 实时获取当前的书的个数
     * @return
     */
    public int getUserSize() {
        return userSize;
    }

    /**
     * 实时的修改当前书架上的书的个数
     */
    public void setUserSize(int size) {
        userSize = size;
    }

    //理论上来说这些操作书架的函数都应该写在这里面。

}
